package com.jetpack.mvvm.lib.common

import android.app.Application
import com.jetpack.mvvm.lib.common.ext.logV
import java.lang.ref.WeakReference

object CommonModule {
    var appContext: WeakReference<Application> = WeakReference(null)
    val application: Application
        get() {
            return appContext.get() ?: throw IllegalArgumentException("Application should be set first")
        }


    fun initModule(app: Application) {
        logV("CommonModule", "initModule")
        appContext = WeakReference(app)
    }
}